home *** CD-ROM | disk | FTP | other *** search
/ Acorn RISC PD-CD 1 / Acorn RISC PD-CD 1.iso / utilities / _graphics / graphics / _jpeg / h / jinclude < prev    next >
Encoding:
Text File  |  1991-10-28  |  2.5 KB  |  76 lines

  1. /*
  2.  * jinclude.h
  3.  *
  4.  * Copyright (C) 1991, Thomas G. Lane.
  5.  * This file is part of the Independent JPEG Group's software.
  6.  * For conditions of distribution and use, see the accompanying README file.
  7.  *
  8.  * This is the central file that's #include'd by all the JPEG .c files.
  9.  * Its purpose is to provide a single place to fix any problems with
  10.  * including the wrong system include files.
  11.  * You can edit these declarations if you use a system with nonstandard
  12.  * system include files.
  13.  */
  14.  
  15.  
  16. /*
  17.  * <stdio.h> is included to get the FILE typedef and NULL macro.
  18.  * Note that the core portable-JPEG files do not actually do any I/O
  19.  * using the stdio library; only the user interface, error handler,
  20.  * and file reading/writing modules invoke any stdio functions.
  21.  * (Well, we did cheat a bit in jvirtmem.c, but only if MEM_STATS is defined.)
  22.  */
  23.  
  24. #include <stdio.h>
  25. /* Needed for Archimedes ANSI C v3 */
  26. #define write(stream,ptr,size) fwrite((ptr),(size),1,(stream))
  27.  
  28. /*
  29.  * We need the size_t typedef, which defines the parameter type of malloc().
  30.  * In an ANSI-conforming implementation this is provided by <stdio.h>,
  31.  * but on non-ANSI systems it's more likely to be in <sys/types.h>.
  32.  */
  33.  
  34. #ifndef __STDC__                /* shouldn't need this if __STDC__ */
  35. #include <sys/types.h>
  36. #endif
  37.  
  38. /*
  39.  * In ANSI C, and indeed any rational implementation, size_t is also the
  40.  * type returned by sizeof().  However, it seems there are some irrational
  41.  * implementations out there, in which sizeof() returns an int even though
  42.  * size_t is defined as long or unsigned long.  To ensure consistent results
  43.  * we always use this SIZEOF() macro in place of using sizeof() directly.
  44.  */
  45.  
  46. #define SIZEOF(object)  ((size_t) sizeof(object))
  47.  
  48. /*
  49.  * We need the memcpy() and strcmp() functions, plus memory zeroing.
  50.  * ANSI and System V implementations declare these in <string.h>.
  51.  * BSD doesn't have the mem() functions, but it does have bcopy()/bzero().
  52.  * NOTE: we assume the size parameters to these functions are of type size_t.
  53.  * Insert casts in these macros if not!
  54.  */
  55.  
  56. #ifdef __STDC__
  57. #include <string.h>
  58. #define MEMZERO(voidptr,size)   memset((voidptr), 0, (size))
  59. #else /* not STDC */
  60. #ifdef BSD
  61. #include <strings.h>
  62. #define MEMZERO(voidptr,size)   bzero((voidptr), (size))
  63. #define memcpy(dest,src,size)   bcopy((src), (dest), (size))
  64. #else /* not BSD, assume Sys V or compatible */
  65. #include <string.h>
  66. #define MEMZERO(voidptr,size)   memset((voidptr), 0, (size))
  67. #endif /* BSD */
  68. #endif /* STDC */
  69.  
  70.  
  71. /* Now include the portable JPEG definition files. */
  72.  
  73. #include "jconfig.h"
  74.  
  75. #include "jpegdata.h"
  76.